home *** CD-ROM | disk | FTP | other *** search
- /*
- * illustrates use of directory routines
- *
- */
-
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/dir.h>
-
- main ()
- {
- DIR *dp;
- struct direct *dep;
-
- if ((dp = opendir (".")) == NULL)
- {
- fprintf (stderr, "cannot open current directory for reading\n");
- exit (1);
- }
-
- while ((dep = readdir (dp)) != NULL)
- (void) printf ("%s\n", dep->d_name);
- closedir (dp);
- return (0);
- }
-